package com.ruoyi.jwxt.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jwxt.domain.PO.JwxtLabScheduling;
import com.ruoyi.jwxt.service.IJwxtLabSchedulingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 排课管理Controller
 */
@RestController
@RequestMapping("/jwxt/scheduling")
public class JwxtLabSchedulingController extends BaseController
{
    @Autowired
    private IJwxtLabSchedulingService jwxtLabSchedulingService;

    /**
     * 查询排课管理列表
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:list')")
    @GetMapping("/list")
    public TableDataInfo list(JwxtLabScheduling jwxtLabScheduling)
    {
        startPage();
        List<JwxtLabScheduling> list = jwxtLabSchedulingService.select(jwxtLabScheduling);
        return getDataTable(list);
    }

    /**
     * 导出排课管理列表
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:export')")
    @Log(title = "排课管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JwxtLabScheduling jwxtLabScheduling)
    {
        List<JwxtLabScheduling> list = jwxtLabSchedulingService.select(jwxtLabScheduling);
        ExcelUtil<JwxtLabScheduling> util = new ExcelUtil<JwxtLabScheduling>(JwxtLabScheduling.class);
        util.exportExcel(response, list, "排课管理数据");
    }

    /**
     * 获取排课管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:query')")
    @GetMapping(value = "/{scheduleId}")
    public AjaxResult getInfo(@PathVariable("scheduleId") Long scheduleId)
    {
        return success(jwxtLabSchedulingService.select(scheduleId));
    }

    /**
     * 新增排课管理
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:add')")
    @Log(title = "排课管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JwxtLabScheduling jwxtLabScheduling)
    {
        return toAjax(jwxtLabSchedulingService.insert(jwxtLabScheduling));
    }

    /**
     * 修改排课管理
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:edit')")
    @Log(title = "排课管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JwxtLabScheduling jwxtLabScheduling)
    {
        return toAjax(jwxtLabSchedulingService.update(jwxtLabScheduling));
    }

    /**
     * 删除排课管理
     */
    @PreAuthorize("@ss.hasPermi('jwxt:scheduling:remove')")
    @Log(title = "排课管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{scheduleIds}")
    public AjaxResult remove(@PathVariable Long[] scheduleIds)
    {
        return toAjax(jwxtLabSchedulingService.delete(scheduleIds));
    }


}
